# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=deepin-voice-note
pkgver=6.0.14
pkgrel=1
pkgdesc='A lightweight memo tool to make text notes and voice recordings'
arch=('loong64' 'x86_64')
url="https://github.com/linuxdeepin/deepin-voice-note"
license=('GPL3')
replaces=('deepin-voice-recorder')
depends=('deepin-qt5integration' 'deepin-qt-dbus-factory' 'dtkcore' 'dtkgui' 'dtkwidget' 'qt5-base'
         'qt5-svg' 'qt5-multimedia' 'qt5-declarative' 'qt5-webchannel' 'qt5-location' 'qt5-webengine'
         'gstreamer' 'vlc' 'glib2' 'gcc-libs')
makedepends=('cmake' 'gmock' 'gtest' 'ninja' 'qt5-tools')
groups=('deepin-extra')
source=("https://github.com/linuxdeepin/deepin-voice-note/archive/$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('252548330b8e00cc28b60538b5d6b4ff17b9c569a8e9e29b166bc29ea678df1d16dc49face676520c7f9204f8dd56866cc07e10bc3333e408af0773e84b64c57')

prepare() {
  cd deepin-voice-note-$pkgver
  sed -i '/include <QSurfaceFormat>/a #include <QStandardPaths>' src/main.cpp
  sed -i '/include <QMimeData>/a #include <QStandardPaths>\n#include <QThreadPool>' src/views/middleview.cpp
}

build() {
  cd deepin-voice-note-$pkgver
  cmake -GNinja .
  ninja
}

check() {
  cd deepin-voice-note-$pkgver
  ninja test || :
}

package() {
  cd deepin-voice-note-$pkgver
  DESTDIR="$pkgdir" ninja install
}
